package com.leyou.order.client;

import com.leyou.order.dto.AddressDTO;

import java.util.ArrayList;
import java.util.List;

/**
 * lcd  2020/6/16
 * Description:
 */
public abstract class AddressClient {
    public static final List<AddressDTO> addressList=new ArrayList<>();
    static {
        AddressDTO dto1 = new AddressDTO();
        dto1.setAddress("邮政三号楼");
        dto1.setCity("fuzhou");
        dto1.setDistrict("gulou");
        dto1.setId(1L);
        dto1.setName("虎哥");
        dto1.setPhone("18012345678");
        dto1.setState("fujian");
        dto1.setZipCode("210000");
        dto1.setIsDefault(true);
        addressList.add(dto1);

        AddressDTO dto2 = new AddressDTO();
        dto2.setAddress("邮政三号楼222");
        dto2.setCity("fuzhou222");
        dto2.setDistrict("gulou222");
        dto2.setId(2L);
        dto2.setName("虎哥22");
        dto2.setPhone("18012345678");
        dto2.setState("fujian2");
        dto2.setZipCode("2100002");
        dto2.setIsDefault(false);
        addressList.add(dto2);
    }
    public static AddressDTO findById(Long id){
        for (AddressDTO addressDTO : addressList) {
            if (addressDTO.getId() == id) {
                return addressDTO;
            }
        }
        return null;
    }
}
